]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageTray: Split out the notification's destroy handler
authorJasper St. Pierre <jstpierre@mecheye.net>
Mon, 14 Oct 2013 01:52:44 +0000 (21:52 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Mon, 14 Oct 2013 19:24:53 +0000 (15:24 -0400)
This is complex enough to split out.

https://bugzilla.gnome.org/show_bug.cgi?id=710115

js/ui/messageTray.js

index 9dfb54cec736c6383b89804b574fe8376bfde38a..76ba60bc3ddff0aa90a6402da8022e0bb2cdc354 100644 (file)
@@ -1406,23 +1406,24 @@ const Source = new Lang.Class({
         return this._mainIcon.actor;
     },
 
+    _onNotificationDestroy: function(notification) {
+        let index = this.notifications.indexOf(notification);
+        if (index < 0)
+            return;
+
+        this.notifications.splice(index, 1);
+        if (this.notifications.length == 0)
+            this._lastNotificationRemoved();
+
+        this.countUpdated();
+    },
+
     pushNotification: function(notification) {
         if (this.notifications.indexOf(notification) >= 0)
             return;
 
         notification.connect('clicked', Lang.bind(this, this.open));
-        notification.connect('destroy', Lang.bind(this,
-            function () {
-                let index = this.notifications.indexOf(notification);
-                if (index < 0)
-                    return;
-
-                this.notifications.splice(index, 1);
-                if (this.notifications.length == 0)
-                    this._lastNotificationRemoved();
-
-                this.countUpdated();
-            }));
+        notification.connect('destroy', Lang.bind(this, this._onNotificationDestroy));
 
         this.notifications.push(notification);
         this.emit('notification-added', notification);